/*
 * @Author: DUST
 * @Date: 2023-06-06 14:40:23
 * @LastEditors: DUST
 * @LastEditTime: 2023-06-09 14:56:43
 * @FilePath: \koa-node-ts\app\validator\NoteValidator.ts
 * @Description: 
 * undefined
 */

import { Rules } from "async-validator";
import Tags from "../model/Tags";

export interface noteItem  {
  title: string;
  content: string;
  description: string;
  tagIds: string;
  tagList?: Array<Tags>;
  userId: string;
}

class NoteValidator {
  private _addRules: Rules = {
    title: [
      {
        type: "string",
        required: true,
        message: "请输入标题"
      }
    ],
    userId: [
      {
        type: "string",
        required: true,
        message: "缺少关键参数"
      }
    ],
    content: [
      {
        type: "string",
        required: true,
        message: "请输入内容"
      }
    ]
  }
  public get addRules() : Rules {
    return this._addRules;
  }
  private _editRules: Rules = {
    title: [
      {
        type: "string",
        required: true,
        message: "请输入标题"
      }
    ],
    userId: [
      {
        type: "string",
        required: true,
        message: "缺少关键参数"
      }
    ],
    content: [
      {
        type: "string",
        required: true,
        message: "请输入内容"
      }
    ]
  }
  public get editRules() : Rules {
    return this._editRules;
  }
  
}

export default new NoteValidator;